package com.example.study.commen.commenutils;


import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

//@Component
public class SpringUtil  {
    private static ApplicationContext applicationContext = null;



    public static void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        if(SpringUtil.applicationContext == null){
            SpringUtil.applicationContext  = applicationContext;
        }
  }

    //获取applicationContext
    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }
}